Skip to main content

default

Type

property

Summary

Specifies that a button will be automatically chosen when the user presses Return or Enter.

Syntax

set the default of <button> to {true | false}

Description

Use the default property when designing cards to be used as dialog boxes. The familiar appearance of the default button is a cue to users about what to expect when they use the shortcut of pressing Return or Enter.

When the user presses Enter or Return and there is no active control, LiveCode sends a mouseUp message to the button whose default property is true. (Also handle the returnInField and enterInField messages to ensure that the default button is activated even if there is a text insertion point or a control is focused.)

If more than one button's default is true, the message is sent to the button whose default property was set to true most recently.

Changing a button's default property increases its size, so it also changes its rectangle (and related properties). Changing the default property does not change the button's location.

Cross-platform note

On OS X systems, the default button throbs rhythmically instead of having a border. Because the throbbing button is drawn by the operating system, its apppearance may not be correct if the button is placed on top of another control. To avoid minor cosmetic problems, place default buttons directly on the card rather than on top of other objects.

Examples

set the default of button "OK" to true
set the default of button otherButton to false

object: card, button

property: dialogData, properties, defaultButton, acceleratorKey, location

glossary: object, property, rectangle, handle, OS X, focus, insertion point, message, appearance, control, dialog box

keyword: default, card, button

message: enterInField, returnInField

Compatibility and Support

Introduced

LiveCode 1.0

OS

mac

windows

linux

ios

android

Platforms

desktop

server

mobile

Thank you for your feedback!

Was this page helpful?